if exists(select name from sysobjects where name = 'sp_NewsGetAllByGroupNewsIdAndTop')
	drop proc sp_NewsGetAllByGroupNewsIdAndTop
go
/*-- =============================================
	Created by: HP
	Created on: 2014-03-23 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_NewsGetAllByGroupNewsIdAndTop.sql
*/-- =============================================

CREATE PROCEDURE sp_NewsGetAllByGroupNewsIdAndTop
	@GroupNewsId INT,
	@TOP int=5
AS
BEGIN
	select top(@TOP)
		a.Id,
		a.[Name],
		a.[Tag],
		a.[Image],
		a.[Content],
		a.[Detail],
		a.[Date],
		a.[Title],
		a.[Description],
		a.[Keyword],
		a.[Priority],
		a.[Index],
		a.[Lang] into #Results from News a WHERE [Active]<>255 and a.GroupNewsId=@GroupNewsId	order by [index]
END
GO
